package com.darren.framework.dao;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;
import com.darren.framework.entity.PageBean;


public interface GenericDao <T,PK extends Serializable> extends BaseDao {
	
	public Map<String,Object> constructHQLQuery(JSONObject queryJson);	
	
	public T save(T entity);
	
	public T merge(T entity);
	
	public T findById(PK id);
	
	public T update(T entity);
	
	public T delete(T entity);
	
	public void deleteById(PK id);
	
	public List<T> getAll();

    /**
     * 
     * @param sql
     * @param pageSize
     * @param currentPage
     * @param objs
     * @return
     */
    public PageBean queryForPageBySQL(String sql,Integer pageSize, Integer currentPage, Object... objs);
    
    
    public List<T> queryByCondition(String hql,Object... objs);

    /**
     *
     * @param parameterJson
     * @param pageSize
     * @param currentPage
     * @return
     */
    public PageBean queryForPageByHQL(String hql,Integer pageSize, Integer currentPage,Object... objs);

}